package com.ftg.learn.chapter09.pattern.singleton;

public class PlaySingleton {

    public static void main(String[] args) {
        /**
         * 它就是产生三个
         * f  - ox123
         * f1 - ox124
         * f2 - ox125
         *
         * 就是我们构造方法 是public
         *
         */
//
//        FirstSingletonPattern f = new FirstSingletonPattern();
//        FirstSingletonPattern f1 = new FirstSingletonPattern();
//        FirstSingletonPattern f2 = new FirstSingletonPattern();
        //没有创建细节
//          FirstSingletonPattern f = FirstSingletonPattern.getInstance();
//          FirstSingletonPattern f1 = FirstSingletonPattern.getInstance();
//          FirstSingletonPattern f2 = FirstSingletonPattern.getInstance();
//
//        System.out.println(f1 == f2);
//        System.out.println(f1 == f);
        SecondSingletonPattern s = SecondSingletonPattern.getInstance();
        SecondSingletonPattern s1 = SecondSingletonPattern.getInstance();

        System.out.println(s == s1);

        Lion l1 = FourSingleton.lion;
        Lion l2 = FourSingleton.lion;

//        你能不能过接口里面定义常量的方式 来完成单例

        System.out.println(l1 == l2);

    }


}
